<script setup lang="ts">
import { ref } from 'vue';
const getBgColor = (item: number) => {
   const colors = ['#FFF9F3', '#F3FFFF', '#FFF3FC'];
   return colors[item - 1];
}
const getHeadBgColor = (item: number) => {
  return `url(https://meizuly.oss-cn-shanghai.aliyuncs.com/xcxPic/h5/vivo-top-${item}.png) no-repeat center center / 100% 100%`;
}
</script>

<template>
  <page class="page" custom-overflow="visible">
    <page-template pageBgColor="#F1F5FF" footerBtnTitle="点击查看更多" :footerBtnIcon="true">
      <view class="head">
        <image src="https://meizuly.oss-cn-shanghai.aliyuncs.com/xcxPic/h5/vivo-head.png" mode="aspectFill"></image>
      </view>
      <view class="banner">
        <view class="banner-head">
          <view class="rect"></view>
          <view class="banner-head-title">IQOO系列</view>
        </view>
        <view class="banner-content">
          <view class="banner-item" v-for="item in 2" :key="item">
            <view class="title">Pura 70 Ultra</view>
            <image src="https://meizuly.oss-cn-shanghai.aliyuncs.com/xcxPic/h5/pura-70.png" mode="aspectFill"></image>
            <view class="mark"><mark-tips style="margin-right: 10rpx;"></mark-tips><discount-button></discount-button></view>
            <view class="bottom">
              <price-box style="margin-right: 20rpx;" num="15.24" color="#FF1717"></price-box>
              <hire-button title="立即抢租"></hire-button>
            </view>
          </view>
        </view>
      </view>
      <view class="banner-one">
        <image src="https://meizuly.oss-cn-shanghai.aliyuncs.com/xcxPic/h5/vivo-banner-1.png" mode="aspectFill"></image>
        <view class="banner-one-body">
          <view class="one-item" :style="{background: getBgColor(item)}" v-for="item in 3" :key="item">
            <view class="one-item-head" :style="{background: getHeadBgColor(item)}">Pura 70 Ultra</view>
            <view class="one-item-content">
              <image src="https://meizuly.oss-cn-shanghai.aliyuncs.com/xcxPic/h5/pura-70.png" mode="aspectFill"></image>
              <view class="one-item-right">
                <view class="desc">2024款</view>
                <view class="discount">立减 600元</view>
                <price-box num="15.24" color="#FF1717"></price-box>
              </view>
            </view>
          </view>
        </view>
      </view>
      <view class="series">
        <image src="https://meizuly.oss-cn-shanghai.aliyuncs.com/xcxPic/h5/vivo-series.png" mode="aspectFill"></image>
        <view class="series-body">
          <view class="series-item" v-for="item in 2" :key="item">
            <view class="img-box">
              <image src="https://meizuly.oss-cn-shanghai.aliyuncs.com/xcxPic/h5/pura-70.png" mode="aspectFill"></image>
              <view class="discount">立减 600元</view>
            </view>
            <view class="series-item-right">
              <view class="title">Pura 70 Ultra</view>
              <view class="desc">探索未见之美</view>
              <view class="bottom">
                <price-box num="15.24" color="#FF1717" style="margin-right: 8rpx;"></price-box>
                <hire-button title="租"></hire-button>
              </view>
            </view>
          </view>
        </view>
      </view>
      <view class="series-one">
        <image src="https://meizuly.oss-cn-shanghai.aliyuncs.com/xcxPic/h5/vivo-banner-2.png" mode="aspectFill"></image>
        <view class="series-one-body">
          <view class="one-item" v-for="item in 2" :key="item">
            <view class="title">Pura 70 Ultra</view>
            <image src="https://meizuly.oss-cn-shanghai.aliyuncs.com/xcxPic/h5/pura-70.png" mode="aspectFill"></image>
            <view class="mark"><mark-tips style="margin-right: 10rpx;"></mark-tips><discount-button></discount-button></view>
            <view class="bottom">
              <price-box style="margin-right: 20rpx;" num="15.24" color="#FF1717"></price-box>
              <hire-button title="立即抢租"></hire-button>
            </view>
          </view>
        </view>
      </view>
      <view class="series" style="margin-bottom: 20rpx;">
        <image src="https://meizuly.oss-cn-shanghai.aliyuncs.com/xcxPic/h5/vivo-series.png" mode="aspectFill"></image>
        <view class="series-body">
          <view class="series-item" v-for="item in 2" :key="item">
            <view class="img-box">
              <image src="https://meizuly.oss-cn-shanghai.aliyuncs.com/xcxPic/h5/pura-70.png" mode="aspectFill"></image>
              <view class="discount">立减 600元</view>
            </view>
            <view class="series-item-right">
              <view class="title">Pura 70 Ultra</view>
              <view class="desc">探索未见之美</view>
              <view class="bottom">
                <price-box num="15.24" color="#FF1717" style="margin-right: 8rpx;"></price-box>
                <hire-button title="租"></hire-button>
              </view>
            </view>
          </view>
        </view>
      </view>
    </page-template>
  </page>
</template>
<style lang="scss" scoped>
.head{
  padding: 30rpx;
  display: flex;
  justify-content: center;
  image{
    width: 645rpx;
    height: 221rpx;
  }
}
.banner{
  padding: 16rpx 12rpx;
  background: #DFE6FF;
  border-radius: 20rpx;
  &-head{
    margin-bottom: 10rpx;
    padding: 10rpx;
    display: flex;
    align-items: center;
    justify-content: center;
    .rect{
      margin-right: 10rpx;
      width: 8rpx;
      height: 20rpx;
      background: #000000;
      border-radius: 7rpx;
    }
    &-title{
      font-family: Alimama ShuHeiTi;
      font-weight: bold;
      font-size: 40rpx;
      color: #000000;
      line-height: 56rpx;
    }
  }
  &-content{
    display: flex;
  }
  &-item{
    margin-right: 10rpx;
    width: calc(50% - 5rpx);
    padding: 16rpx;
    display: flex;
    flex-direction: column;
    align-items: center;
    background: #FFFFFF;
    border-radius: 20rpx;
    &:last-child{
      margin-right: 0;
    }
    image{
      width: 143rpx;
      height: 172rpx;
      border-radius: 18rpx;
    }
    .title{
      font-family: Alibaba PuHuiTi;
      font-weight: bold;
      font-size: 29rpx;
      color: #000000;
      line-height: 41rpx;
    }
    .mark{
      margin-top: 16rpx;
      margin-bottom: 25rpx;
      display: flex;
      align-items: center;
    }
    .bottom{
      width: 100%;
      display: flex;
      align-items: center;
      justify-content: space-between;
    }
  }
}
.banner-one{
  margin-top: 20rpx;
  padding: 16rpx 12rpx;
  background: #FFFFFF;
  border-radius: 20rpx;
  image{
    margin-bottom: 14rpx;
    width: 100%;
    height: 258rpx;
  }
  &-body{
    display: flex;
  }
}
.one-item{
  flex: 1;
  margin-right: 10rpx;
  border-radius: 20rpx;
  &:last-child{
    margin-right: 0;
  }
  &-head{
    height: 52rpx;
    line-height: 52rpx;
    text-align: center;
    font-family: Alibaba PuHuiTi;
    font-weight: bold;
    font-size: 29rpx;
    color: #000000;
  }
  &-content{
    margin-top: 10rpx;
    display: flex;
    image{
      width: 96rpx;
      height: 110rpx;
    }
  }
  &-right{
    display: flex;
    flex-direction: column;
    align-items: center;
    .desc{
      font-family: PingFang SC;
      font-weight: bold;
      font-size: 20rpx;
      color: #999999;
      line-height: 28rpx;
    }
    .discount{
      padding: 0 8rpx;
      height: 32rpx;
      line-height: 32rpx;
      font-family: PingFang SC;
      font-weight: bold;
      font-size: 20rpx;
      background: #FF1717;
      color: #ffffff;
      line-height: 28rpx;
      border-radius: 10rpx;
    }
  }
}
.series{
  margin-top: 20rpx;
  padding: 16rpx 12rpx;
  background: #FFFFFF;
  border-radius: 20rpx;
  image{
    height: 258rpx;
    width: 100%;
    border-radius: 20rpx;
  }
  &-body{
    margin-bottom: 16rpx;
    display: flex;
  }
  &-item{
    flex: 1;
    padding: 10rpx 20rpx 10rpx 10rpx;
    display: flex;
    position: relative;
    &:last-child{
      &::after{
        display: none;
      }
    }
    &::after{
      content: '';
      position: absolute;
      right: 0;
      top: 16rpx;
      bottom: 16rpx;
      width: 1rpx;
      background: #eeeeee;
    }
    .img-box{
      flex-shrink: 0;
      position: relative;
      width: 120rpx;
      height: 144rpx;
      padding: 10rpx 8rpx;
      border-radius: 18rpx;
      image{
        width: 100rpx;
        height: 120rpx;
        border-radius: 18rpx;
      }
      .discount{
        margin-left: -10rpx;
        width: 100%;
        position: absolute;
        bottom: 0;
        padding: 0 8rpx;
        height: 32rpx;
        line-height: 32rpx;
        background:#FF1717;
        font-family: PingFang SC;
        font-weight: bold;
        font-size: 20rpx;
        color: #FFFFFF;
        border-radius: 10rpx;
      }
    }
    &-right{
      padding-top: 10rpx;
      flex: 1;
      .title{
        font-family: Alibaba PuHuiTi;
        font-weight: bold;
        font-size: 29rpx;
        color: #000000;
        line-height: 41rpx;
      }
      .desc{
        margin-top: 5rpx 0;
        font-family: PingFang SC;
        font-weight: bold;
        font-size: 24rpx;
        color: #999999;
        line-height: 33rpx;
      }
      .bottom{
        display: flex;
        align-items: center;
      }
    }
  }
}
.series-one{
  margin-top: 20rpx;
  padding: 16rpx 12rpx;
  background: #FFFFFF;
  border-radius: 20rpx;
  image{
    width: 100%;
    height: 258rpx;
  }
  &-body{
    margin-top: 10rpx;
    display: flex;
    .one-item{
      flex: 1;
      padding: 16rpx 12rpx;
      display: flex;
      flex-direction: column;
      align-items: center;
      .title{
        font-family: Alibaba PuHuiTi;
        font-weight: bold;
        font-size: 29rpx;
        color: #000000;
        line-height: 41rpx;
      }
      image{
        width: 143rpx;
        height: 172rpx;
        border-radius: 18rpx;
      }
      .mark{
        margin-top: 16rpx;
        margin-bottom: 25rpx;
        display: flex;
        align-items: center;
      }
      .bottom{
        display: flex;
        align-items: center;
      }
    }
  }
}
</style>

